home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Health Monitor 2.1 / HealthMonitor.msi / _A9A458837CEAFF9D55B2EAE342FFA8DF / _7EBB49D83B25429A81CEE4CC61679C98 < prev    next >
Encoding:
Text File  |  2005-01-03  |  696 b   |  22 lines

  1. ' ***************************************************************
  2. ' * CheckPing.vbs                               *        
  3. ' * By Vittorio Pavesi (www.vittorio.tk)              *
  4. ' *                                * 
  5. ' * Check number of active Terminal Server Sessions        *     
  6. ' ***************************************************************
  7.  
  8. CheckPing("192.168.15.21")
  9.  
  10. Sub CheckPing(host)
  11. result = "Error"
  12. Set obj1 = WScript.CreateObject("WScript.Shell")
  13. Set obj2 = obj1.Exec("cmd /c ping -n 4 -w 1000 " & host)
  14. Do While Not obj2.StdOut.AtEndOfStream
  15.     strText = obj2.StdOut.ReadLine()
  16.     If Instr(strText, "Reply") > 0 Then
  17.         result = "OK"
  18.         Exit Do
  19.     End If
  20. Loop
  21. Wscript.Echo Result & vbcrlf & strText
  22. End Sub